<template>

    <!-- 组件的模板 -->
    <div class="page__bd">
        <div class="weui-search-bar" id="searchBar">
            <form class="weui-search-bar__form">
                <div class="weui-search-bar__box">
                    <i class="weui-icon-search"></i>
                    <input type="search" class="weui-search-bar__input" id="searchInput" placeholder="搜索" required="">
                    <a href="javascript:" class="weui-icon-clear" id="searchClear"></a>
                </div>
                <label class="weui-search-bar__label" id="searchText" style="transform-origin: 0px 0px 0px; opacity: 1; transform: scale(1, 1);" @click="toSearch(this.origin_type)">
                    <i class="weui-icon-search"></i>
                    <span>搜索</span>
                </label>
            </form>
        </div>
    </div>
    <div class="page user-select multi-select">
      <scroller :lock-y="true" v-ref:scrollerdom>
        <div class="mod-crumbs bg-color scroller-wrap" v-show="hierarchyList.length>1">
          <template v-for="(index,hierarchy) in hierarchyList">
                <template v-if="index<(hierarchyList.length-1)">
                    <a class="nav-item" @click="stepHierarchy(index)">{{hierarchy.name}}</a>
                    <span class="arrow nav-item">&gt;</span>
                </template>
                <template v-if="index==(hierarchyList.length-1)">
                    <em class="nav-item">{{hierarchy.name}}</em>
                </template>
          </template>
        </div>
      </scroller>
    <!--     <ul class="list com-border-top com-border-bottom">
          <li class="weui-cells_checkbox">
              <label class="touch" for="ss">
                  <input type="checkbox" class="weui-check" name="ss" id="ss" :checked="isSelectAll"  @click="selectAll($event)">
                  <i class="weui-icon-checked"></i>
                  <div class="info com-border-bottom">
                      <p class="title">全选</p>
                  </div>
              </label>
          </li>
    </ul>  -->
    <div class="scroll_line">
     <ul class="list com-border-top com-border-bottom" style="margin-top:0" v-if="grouplist.length != 0">
            <li class="weui-cells_checkbox has-hierarchy"  v-for='group in grouplist'>
                <label class="touch" for="{{group.id+'group'}}">
                     <input value="{{group.id}}" 
                             v-model="selectGroupList" 
                             type="checkbox" 
                             class="weui-check" 
                             name="group"
                             id="{{group.id+'group'}}"
                             @change="selectMemberByGroupId(group.id,$event)"
                      >
                    <i class="weui-icon-checked"></i>
                    <div class="info com-border-bottom">
                        <p class="title" :class="{'no-nextGroup': !(group.memberList.length||group.children.length)}">{{group.name}}</p>
                    </div>
                </label>
                <div class="hierarchy" :class="{'disabled':selectGroupList.indexOf(group.id+'')>-1}" v-show="group.memberList.length||group.children.length" @click="stepNext(group.id,this.origin_type)">下级</div>
            </li>
     </ul>
     <ul class="list com-border-top com-border-bottom" style="margin-top:0" :style="isIphoneX?'margin-bottom: 37px;':''">
          <li class="weui-cells_checkbox" v-for="member in memberList">
              <label class="touch" for="{{member.user_id+'member'}}">
                   <input value="{{member.user_id}}"
                           v-model="selectMemberList"
                           type="checkbox"
                           class="weui-check"
                           name="member"
                           id="{{member.user_id+'member'}}"
                    >
                  <i class="weui-icon-checked"></i>
                  <img v-if="member.logo.thumb_url!=''" class="avatar" :src="member.logo.thumb_url">
                  <img v-if="member.logo.thumb_url==''" class="avatar" src="../../static/imgs/avatar.png">
                  <div class="info com-border-bottom">
                      <p class="name">{{member.nick_name}}
                        <span class="tag tag_1" v-if="member.identity!=999999" 
                              :class="{'tag tag_1':member.identity==2||member.identity==1,
                                       'tag tag_2':member.identity==3}">{{member.identity_str}}</span>
                      </p>
                      <span class="state" v-if="member.normal">{{member.normal}}</span>
                  </div>
              </label>
          </li>
    </ul>
    </div>
    <div class="count bg-color com-border-top weui-cells_checkbox" :style="isIphoneX?'height: 75px;':''" v-if="memberList.length || grouplist.length">
            <label for="sa">
                <input type="checkbox" class="weui-check" name="select-all" id="sa" :checked="isSelectAll"  @click="selectAll($event)">
                <i class="weui-icon-checked"></i><span>全选</span>                
            </label>
            <span class="num">已选择：<em>{{selectMemberList.length}}人</em></span>
            <template v-if="origin_type == 'sign'">              
              <a class="mod-btn-s-1" @click="submitResult" :class="{'disabled': !isValidation}" href="javascript:;">确定</a>
            </template>
            <template v-else>              
              <a class="mod-btn-s-1" @click="submitResult" href="javascript:;">确定</a>
            </template>
        </div>
    </div>
   </div>
</template>

<script>
    let pageDate = {}
    let webViewID = ''
    /**
     *  引入工具类库 或 Native API
     *  example : import widget from 'gapi/widget'
     */

    /**
     *  引入组件 以及 组件接口(Action)
     *  example : import Somecomponents from 'components/Somecomponents/Somecomponents'
     */
    import widget from 'gapi/widget'
    import cache from 'gapi/cache.js'
    import commonPage from 'clientApi/commonPage.js'
    import * as util from 'js/util.js'
    import GroupUtil from 'js/GroupUtil.js'
    import Scroller from 'vux/dist/components/scroller'
    import clientUi from 'gapi/clientUi.js'
    import KCApiApp from 'clientApi/KCApiApp.js'

    /**
     *  组件实例对象
     */
    export default {
        components: {
          Scroller
        },
        data: function(){
            return{
                id:'',
                hierarchyList:[],
                selectMemberList:[],
                selectGroupList:[],
                grouplist:[],
                memberList:[],
                cacheGroupList:[],
                group:{},
                type_id:'',  // 从工资进入--判断是否从工资进入 type_id==1为工资进入，否则不是
                is_empty:'',   // 从工资进入--判断是否是从空太页面进入
                start_date:'', //从工资进入会有开始日期和结束日期
                end_date:'',
                origin_type: '',//判断是从考勤还是位置监控进入
            }
        },
        watch: {
          'hierarchyList': function(){
            let allWidth = 0
            this.$nextTick(function () {
              if($('.scroller-wrap .nav-item').length){
                $('.scroller-wrap .nav-item').each(function(i, o){
                  if(o.tagName.toLowerCase() == 'a'){
                    allWidth += (parseInt(o.offsetWidth) + 16)
                  }else{
                    allWidth += parseInt(o.offsetWidth)
                  }
                })
                allWidth += 30
                $('.scroller-wrap').width(allWidth + 'px')

                this.$refs.scrollerdom.reset()
              }
            })
          }
        },
        computed: {
            isSelectAll (){
                let result = false
                if(this.grouplist.length||this.memberList.length){
                    result = true
                    this.grouplist.forEach((item)=>{
                        if(this.selectGroupList.indexOf(item.id+'')==-1){
                              // this.selectMemberList = this.removeArrarItem(this.selectMemberList,[this.id])
                              result = false
                        }
                    })
                    this.memberList.forEach((item)=>{
                      if(this.selectMemberList.indexOf(item.user_id+'')==-1){
                            // this.selectMemberList = this.removeArrarItem(this.selectMemberList,[this.id])
                            result = false
                      }
                    })                    
                    console.log("111"+JSON.stringify(this.selectMemberList))
                }
                return result
            },
            isValidation () {                
                return !!this.selectMemberList.length
            },
            isIphoneX: function(){
                return util.isIphoneX()
            }
        },
        vuex: {
            getters: {

            },
            actions: {

            }
        },
        methods: {
            /**
             * 初始化
             * @method init
             * @public
             * @return {Null} void
             */

            init (){
                // //从工资进入--判断是否从工资进入 type_id==1为工资进入，否则不是
                // this.type_id = util.getUrddataString('type_id')  
                // // 从工资进入--判断是否是从空太页面进入
                // this.is_empty = util.getUrddataString('is_empty')  
                // // this.is_empty = 1
                // this.start_date = util.getUrddataString('start_date')  
                // this.end_date = util.getUrddataString('end_date') 
                
                // // if(!this.id){
                // //   console.log('type_id——'+this.type_id) 
                // //   console.log('is_empty——'+this.is_empty)
                // //   console.log('start_date——'+this.start_date)
                // //   console.log('end_date——'+this.end_date)
                // // }
                this.origin_type = util.getUrddataString('origin_type')                
                // //从考勤进入时：如果考勤有已选人员，则带过来默认选中                
                cache.getMemoryCache('memberSelect',(data)=>{
                  // console.log(JSON.stringify(data))
                    if(data){
                      this.user_id = data.user_id;
                    }
                })

                if (util.getUrddataString('status') === "is_forom_project_detail") {
                    pageDate.project_id = util.getUrddataString('projectId')
                    pageDate.team_id = util.getUrddataString('teamId')
                    this.id = util.getUrddataString('id');
                    if (this.id) {
                      cache.getMemoryCache('cacheGroupList', (data) => {
                          if(data){
                              this.group = new GroupUtil(data)
                              this.showGroup(this.id,this.group.group)
                          }
                      })                    
                    } else {
                      this.getGroupList()
                    }
                } else {
                  cache.getMemoryCache('participantMember', (data) => {
                    console.log(data)
                      if(data){
                        this.selectMemberList = data  
                        console.log("222"+JSON.stringify(this.selectMemberList)) 
                      }
                  })
                    cache.getCache('KqCacheMessge',(data)=>{
                        pageDate.project_id = data.project_id
                        pageDate.team_id = data.team_id
                        pageDate.user_id = data.user_id    
                        this.id = util.getUrddataString('id')
                        if(this.id){
                              cache.getMemoryCache('cacheGroupList', (data) => {
                                  if(data){
                                      this.group = new GroupUtil(data)
                                      this.showGroup(this.id,this.group.group)
                                  }
                              })
                        }else{
                            this.getGroupList()
                        }
                    })

                }                
                commonPage.getWebViewID((data)=>{
                    webViewID = data

                })
            },
            selectMemberByGroupId(id,event){
                  let list = []
                  let label = event.target.checked
                  let setChildGroup = (group) => {
                    group.forEach((o, i, a) => {
                      group[i].memberList.forEach((oo, ii, aa) => {
                           list.push(oo.user_id+'')
                      })
                      if(o.children.length > 0){
                        setChildGroup(o.children)
                      }
                    })
                  }
                  let setCurrentGroup = (group) => {
                    group.some((o, i, a) => {
                    if(o.id == id){
                        o.memberList.forEach((oo, ii, aa) => {
                            list.push(oo.user_id+'')
                        })
                        if(o.children.length){
                            setChildGroup(o.children)
                        }
                        return true
                      }
                    })
                  }
                setCurrentGroup(this.grouplist)
                if(label){
                    this.selectMemberList = this.group.addArrarItem(this.selectMemberList,list)
                    console.log(this.selectMemberList)
                    console.log("333"+JSON.stringify(this.selectMemberList))
                }else{
                    this.selectMemberList = this.group.removeArrarItem(this.selectMemberList,list)
                    console.log(this.selectMemberList)
                    console.log("444"+JSON.stringify(this.selectMemberList))
                }
            },
            //全选按钮
            selectAll(event){//is_select  0 正常 1被选中
                let label = event.target.checked
                let list = []
                let groupList = []
                this.grouplist.forEach((item)=>{
                    groupList.push(item.id+'')
                    this.selectMemberByGroupId(item.id,event)
                })
                this.memberList.forEach((item)=>{
                   list.push(item.user_id+'')
                })
                if(label){
                    this.selectMemberList = this.group.addArrarItem(this.selectMemberList,list)
                    this.selectGroupList = this.group.addArrarItem(this.selectGroupList,groupList)
                    console.log("555"+JSON.stringify(this.selectMemberList))
                }else{
                    this.selectMemberList = this.group.removeArrarItem(this.selectMemberList,list)
                    this.selectGroupList = this.group.removeArrarItem(this.selectGroupList,groupList)
                    console.log("999"+JSON.stringify(this.selectMemberList))
                }
            },
            /**
             * 跳转下一级
             * @param  {[type]}
             * @return {[type]}
             */
            stepNext(id,origin_type){
                if(this.selectGroupList.indexOf(id+'') == -1){
                    cache.setMemoryCache('cacheGroupList',this.group.group)
                    cache.setMemoryCache('participantMember',this.selectMemberList)
                    // console.log(util.getUrddataString('status'))
                    if(util.getUrddataString('status')){
                        let i = util.getUrddataString('is_move')
                        // window.location.href="dmsaas://KaoqinAddMember?urdData="+encodeURIComponent(`id=${id}&is_move=${i}`)

                        window.location.href="dmsaas://KaoqinAddMember?urdData="+encodeURIComponent(`id=${id}&is_move=${i}&status=is_forom_project_detail&projectId=${pageDate.project_id}&teamId=${pageDate.team_id}&origin_type=${origin_type}`)
                    }else{
                        window.location.href="dmsaas://KaoqinAddMember?urdData="+encodeURIComponent(`id=${id}&origin_type=${origin_type}`)
                    }
                    
                    // window.location.href="http://192.168.45.155:8000/app/yy_kqgroupselect/yy_kqgroupselect.html?urdData="+encodeURIComponent(`id=${id}`)
                }
            },
            /**
             * 点击对应层级
             *
             * @return {[type]}
             */
            stepHierarchy(index){
              console.log(index)
                let leg = this.hierarchyList.length-1
                if(index<leg){
                    cache.getMemoryCache('webViewID'+index,(data)=>{
                        if(data){
                           commonPage.goBack(1,{'key':'participantMember','value':this.selectMemberList},data.webViewID)
                        }
                    })
                }
            },
            // 当前页面数据处理
            showGroup(id,list){
                list.some((item)=>{
                  if(item.id==id){
                      item.path.splice(0,1)//人员选择去掉全部一级
                      this.hierarchyList = item.path
                      this.grouplist = item.children
                      //按照成员身份由高到低
                      item.memberList.sort(function(a,b){
                        return a.identity-b.identity;
                      });
                      this.memberList = item.memberList
                      let len = this.hierarchyList.length-1
                      cache.setMemoryCache('webViewID'+len,{'webViewID':webViewID})//保存当前页面唯一标识，点击面包屑使用
                      return true
                  }else{
                      this.showGroup(id,item.children)
                  }
              })
            },
            // 获取小组列表
            getGroupList(){
                let _data = ''
                if(this.type_id && this.type_id == 1){
                    _data = {
                        team_id:pageDate.team_id,
                        project_id: pageDate.project_id,
                        type_id:this.type_id,
                        start_date:this.start_date,
                        end_date:this.end_date
                    }
                }else{
                    _data = {
                        team_id:pageDate.team_id,
                        project_id: pageDate.project_id,
                        type_id:0,
                        start_date:'',
                        end_date:''
                    }
                }
                // console.log(JSON.stringify(_data))
                console.log(_data)
                commonPage.loadPageStatus('loading')
                util.ajax({
                    url: '/group/node_tree',
                    data: _data,
                    success: (res) => {
                        console.log(res)
                        commonPage.loadPageStatus('loadSuccess')
                        if(res&&res.errno==0){
                            this.cacheGroupList = res.data
                            this.group = new GroupUtil(this.cacheGroupList)
                            // this.hierarchyList = [{'id':'all','name':'全部'}]
                            // this.grouplist = this.cacheGroupList
                            let allMemberList = this.group.formatMember(this.cacheGroupList)
                            console.log(allMemberList)
                            cache.setMemoryCache('allMemberList', allMemberList)
                            this.showGroup(this.cacheGroupList[0].id,this.cacheGroupList)
                            // if(this.is_empty && this.is_empty == 1){

                            //     let selectM = []
                            //     allMemberList.forEach( (item) => {
                            //         if(item.normal != '未出勤'){
                            //             selectM.push(item.user_id)
                            //         }
                            //     })
                            //     console.log(selectM)
                            //     if(selectM.length){
                            //       this.selectMemberList = selectM
                            //       console.log(this.selectMemberList)
                            //     }
                            //     if(selectM.length && !this.id){
                            //       widget.toast('已默认选中出勤人员')
                            //     }
                            // }
                            
                        }else if(res.errmsg){
                             widget.toast(res.errmsg)
                        }else{
                            widget.toast('获取成员列表失败')
                        }
                    },
                    error: (xhr, status) => {
                        commonPage.loadPageStatus('loadSuccess')
                        widget.toast('服务器异常')
                    },
                    noNetwork: () => {
                      commonPage.loadPageStatus('loadSuccess')
                      widget.toast('网络连接失败，请检查网络')
                    }
                })
            },
            //提交
            submitResult() {
                if(this.origin_type == 'sign' && this.selectMemberList.length == 0){
                  widget.toast('选择人员范围不可为空');
                  return
                }
                var participantMember = this.selectMemberList
                console.log("666"+JSON.stringify(this.selectMemberList))
                // if (this.selectMemberList.length == 0) {
                //   widget.toast('请选择人员');
                //   return;
                // }
                if (util.getUrddataString('status') === "is_forom_project_detail") {
                    //is_move  是否批量移动的标志
                    //1表示批量移动  0表示批量标记离职，也就是删除
                    if (util.getUrddataString('is_move') === '0') {
                      //批量标记离职
                      
                      //超级管理员的id
                      var superManId; 
                      this.memberList.forEach((item)=>{
                        if(item.identity_str === '超级管理员'){
                              superManId = item.user_id;
                        }
                      })
                      
                      var hasSuperManFlag = false;
                      this.selectMemberList.forEach((item)=>{
                          if (item == superManId) {
                            hasSuperManFlag = true;
                          } 
                      })

                      if (hasSuperManFlag == true) {
                        widget.toast('超级管理员不可被标为离职');
                        return;
                      }

                      var isSelfFlag = false;
                      this.selectMemberList.forEach((item) => {
                        if (item == this.user_id) {
                          isSelfFlag = true;
                        }
                      })
                      if (isSelfFlag == true) {
                        widget.toast('自己不可被标记为离职');
                        return;
                      }

                      let dialogtxt = '将选中人员标记为离职？';
                      clientUi.showDialog(dialogtxt, '', function(data){
                          if(data.status == 1){
                              cache.getMemoryCache('memberViewId',(data)=>{
                                  if(data){
                                    // commonPage.goBack(1,{'key':'participantMember','value':participantMember,'is_move':util.getUrddataString('is_move')},data.webViewID)
                                    util.ajax({
                                      url:'/group/batch/member_remove',
                                      type:'POST',
                                      data:{
                                          // group_id: this.groupId,
                                          team_id: util.getUrddataString('teamId'),
                                          project_id : util.getUrddataString('projectId'),
                                          user_id:JSON.stringify(participantMember)
                                      },
                                      success:(result) => {
                                        //埋点
                                        let statisticsLog_data = {
                                            event_id: '批量标记离职-确定_弹层',
                                            // event_label: data.event_label,(预留，现在不用传此参数)
                                            event_param: {
                                                ca_from: 'sure',
                                                project_id: util.getUrddataString('projectId'),
                                            }
                                        }
                                        // console.log(JSON.stringify(statisticsLog_data))
                                        KCApiApp.statisticsLog(statisticsLog_data)

                                          if(result.errno == 0){
                                              widget.toast('成功标记为离职');    
                                              commonPage.goBack(1,{'value':participantMember,'is_move':util.getUrddataString('is_move')},data.webViewID);
                                          }
                                      },
                                      error: (xhr, status) => {
                                          // error
                                          var toastStr = ''
                                          if(status == 'timeout'){
                                            toastStr = '网络请求超时'
                                          }else{
                                            toastStr = '服务器异常'
                                          }
                                          widget.toast(toastStr)
                                      },
                                      noNetwork: () => {
                                          // 无网络的回调
                                          widget.toast('网络连接失败，请检查网络')
                                      }

                                    })
                                  }
                              })
                          }else{

                          }
                      },'确定','取消')

                    } else {
                      var mangementMan = [];
                      console.log("批量移动人员数据"+JSON.stringify(this.memberList))
                      console.log("选中"+JSON.stringify(this.selectMemberList))
                      this.memberList.forEach((item)=>{
                        if(item.identity_str === '超级管理员' || item.identity_str === '管理员'){
                          mangementMan.push(item.user_id);
                        }
                      })

                      var hasFlag = false;
                      this.selectMemberList.forEach((item) => {
                          mangementMan.forEach((man) => {
                              if (man == item) {
                                  hasFlag = true;
                                  return;        
                              }      
                          })
                      })
                      if (hasFlag) {
                        widget.toast('超级管理员或管理员不可被移动小组');
                        return;
                      }
                      
                      var isSelf = false;
                      this.selectMemberList.forEach((item) => {
                        if (item == this.user_id) {
                          isSelf = true;
                        }
                      })
                      if (isSelf == true) {
                        widget.toast('批量移动不可包含自己');
                        return;
                      }

                      //埋点
                      let statisticsLog_data = {
                          event_id: '批量移动人员页-确定',
                          // event_label: data.event_label,(预留，现在不用传此参数)
                          event_param: {
                              ca_from: 'sure',
                              project_id: pageDate.project_id,
                          }
                      }
                      // console.log(JSON.stringify(statisticsLog_data))
                      KCApiApp.statisticsLog(statisticsLog_data)

                      let encodeStr = encodeURIComponent(`teamId=${pageDate.team_id}&projectId=${pageDate.project_id}&user_id=${participantMember}&is_move=yes`)
                      window.location.href = `dmsaas://GroupSelectSingle?urdData=${encodeStr}`

                    }
                  } else {
                      cache.getMemoryCache('webViewID',(data)=>{
                        console.log(JSON.stringify(data))
                          if(data){                            
                            if(this.origin_type == 'sign'){
                              let participantPerson = participantMember.length
                              this.memberList.forEach((obj1) => {
                                this.selectMemberList.forEach((obj2) => {
                                  if(obj2 == obj1.user_id){                                   
                                    participantPerson --                              
                                  }
                                })
                              }) 
                              let participantPerson2 = participantMember.length - participantPerson
                              let sign_participantMember = {
                                participantMember_userId: participantMember,
                                participantMember_groupNum: this.selectGroupList.length,
                                participantMember_userNum: participantPerson2
                              }              
                              commonPage.goBack(1,{'key':'participantMember','value':sign_participantMember},data.webViewID)
                            }else{
                              commonPage.goBack(1,{'key':'participantMember','value':participantMember},data.webViewID)
                            }
                          }
                      })


                  }

                                
            },
            /**
             * 跳转搜索页
             * @return {}
             */
            toSearch(origin_type){
                cache.setMemoryCache('participantMember',this.selectMemberList)
                // window.location.href="dmsaas://KaoqinMemberSearch"
                let i = util.getUrddataString('is_move')
                let url = `is_move=${i}&origin_type=${origin_type}`
                location.href = "dmsaas://KaoqinMemberSearch?urdData=" + encodeURIComponent(url)
            }
        },
        created(){
            this.init()
            window.loadData = (data)=>{
                // console.log(JSON.stringify(data))

                if(data&&data.key == 'participantMember'){
                    cache.getMemoryCache('cacheGroupList',(item)=>{
                        console.log(this.group)
                        this.group.group = item
                        this.selectMemberList = data.value
                        console.log("777"+JSON.stringify(this.selectMemberList))
                     })
                } else if (data&&data.key == 'selectM'){
                  if (data.pream == 1) {
                    //批量移动
                    var value = data.value;
                    var mangementMan = [];
                    
                    this.memberList.forEach((item)=>{
                      if(item.identity_str === '超级管理员' || item.identity_str === '管理员'){
                        mangementMan.push(item.user_id);
                      }
                    })

                    var hasFlag = false;
                    value.forEach((item) => {
                        mangementMan.forEach((man) => {
                            if (man == item) {
                                hasFlag = true;
                                return;        
                            }      
                        })
                    })

                    if (hasFlag) {
                      widget.toast('超级管理员或管理员不可被移动小组');
                      return;
                    }

                    let encodeStr = encodeURIComponent(`teamId=${pageDate.team_id}&projectId=${pageDate.project_id}&user_id=${value}&is_move=yes`)
                    window.location.href = `dmsaas://GroupSelectSingle?urdData=${encodeStr}`
                  } else {
                    //批量标记离职
                     //超级管理员的id
                      var superManId; 
                      this.memberList.forEach((item)=>{
                        if(item.identity_str === '超级管理员'){
                              superManId = item.user_id;
                        }
                      })
                      
                      var value = data.value;
                      var hasSuperManFlag = false;
                      value.forEach((item)=>{
                          if (item == superManId) {
                            hasSuperManFlag = true;
                          } 
                      })

                      if (hasSuperManFlag == true) {
                        widget.toast('超级管理员不可被标为离职');
                        return;
                      }

                      let dialogtxt = '将选中人员标记为离职？';
                      clientUi.showDialog(dialogtxt, '', function(data){
                          if(data.status == 1){
                              cache.getMemoryCache('memberViewId',(data)=>{
                                  if(data){
                                    commonPage.goBack(1,{'key':'participantMember','value':value,'is_move':util.getUrddataString('is_move')},data.webViewID)
                                  }
                              })
                          }else{

                          }
                      },'确定','返回')
                  }
                }
            }
        },
        ready(){
            commonPage.updateTitleBar({
              backAction: 'gotoback',
              leftAction: 'gotoback'
            })

            

            window.gotoback = () => {
              this.selectMemberList = []
              
                if(this.id){

                  this.selectMemberList = []

                  commonPage.goBack(1,{'key':'participantMember','value':this.selectMemberList})
                }else{
                  commonPage.goBack(1)
                }
            }
        }
    }


</script>

<!-- CSS 样式 -->
<style src="../../node_modules/weui/dist/style/weui.css"></style>
<style src="../../static/css/common.css"></style>
<style src="../../static/css/user-list.css"></style>
<style>
  .scroller-wrap .nav-item{
    float: left;
  }
  .mod-crumbs .arrow.nav-item{
    margin: 18px 8px;
  }
  .xs-container{
    background: #fff;
  }
  .scroll_line{
    overflow:hidden;
  }
</style>
